package test.com.sms.selenium.singlepoint.util;

import org.openqa.selenium.By;

import test.com.sms.selenium.framework.SeleniumPageUtil;
import test.com.sms.selenium.util.SeleniumUtil;

public class SpReportsScorecardChartsPageUtil extends SeleniumPageUtil {
	public final static By RSC_IMG_INCIDENTS = By.id("ctl44_ChartingControl1_Chart1");
	public final static By RSC_IMG_ASSETS_BY_ALL_ASSETS = By.id("ctl44_ChartingControl2_Chart1");
	
	public static void enterReportsScorecardChartsPage() {
		SpHomePageUtil.enter();
		SpHomePageUtil.enterReportsDefaultPage();
		SeleniumUtil.click(SeleniumUtil.getCachedElement(SpReportsDefaultPageUtil.RD_LINK_CHARTS));
		SeleniumUtil.click(SeleniumUtil.getCachedElement(SpReportsDefaultPageUtil.RD_LINK_CHARTS));
		waitForPageToLoad();
	}
	public static void waitForPageToLoad() {
		SeleniumUtil.selectDefaultContent();
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_CONTENT_NAME);
		SeleniumUtil.selectFrame(SpHomePageUtil.HOME_FRAME_REPORTS_NAME);
		SeleniumUtil.waitOnElements(new By[]{
				RSC_IMG_INCIDENTS, RSC_IMG_ASSETS_BY_ALL_ASSETS
			});
		
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RSC_IMG_INCIDENTS));
		SeleniumUtil.isDisplayed(SeleniumUtil.findElement(RSC_IMG_ASSETS_BY_ALL_ASSETS));
	}
}
